<template>
    <div class="menu">
        <Menu ref="menu" :active-name="menu" theme="dark" width="auto" :open-names="['1']" @on-select="openView">
                <div class="layout-logo-left" style="position:relative;"><img src="../images/menubg.jpg">
                  <div style="position:absolute;bottom:5px;color:white;text-align:center;width:100%;">{{pcode}}<br>{{pname}}</div>
                </div>

                <MenuItem name="/公司信息" v-if="ptype==1">简易版公司信息</MenuItem>
                <MenuItem name="/公司信息" v-if="ptype>1">公司信息</MenuItem>
                <MenuItem name="/校招职位" v-if="ptype>0">校招职位</MenuItem>
                <MenuItem name="/社招职位" v-if="ptype>0">社招职位</MenuItem>
                <MenuItem name="/招聘流程" v-if="ptype>1">招聘流程</MenuItem>
                <MenuItem name="/宣讲行程" v-if="ptype>1">宣讲行程</MenuItem>
                <MenuItem name="/项目分享" v-if="ptype>0">项目分享</MenuItem>
                <MenuItem name="/Q&A" v-if="ptype>1">Q&A</MenuItem>
                <MenuItem name="/最新资讯" v-if="ptype>2">最新资讯</MenuItem>
                <MenuItem name="/网申查询" v-if="ptype>1">网申查询</MenuItem>
                <MenuItem name="/vr360" v-if="ptype>1">vr360</MenuItem>
                <MenuItem name="/questionnaire" v-if="pquestionnaire==1">外部雇主调研板块</MenuItem>
                <Submenu name="/预备员工专区" v-if="preservestaff==1">
                    <template slot="title">预备员工专区</template>
                    <MenuItem name="/staffnews">信息轮播</MenuItem>
                    <MenuItem name="/staffs">预备员工</MenuItem>
                    <MenuItem name="/reward">奖励</MenuItem>
                    <!-- <MenuItem name="/signin">签到</MenuItem> -->
                    <MenuItem name="/train">培训</MenuItem>
                    <MenuItem name="/activity">活动</MenuItem>
                    <MenuItem name="/task">新手任务</MenuItem>
                </Submenu>
        </Menu>
    </div>
</template>
<script>
export default {
        data() {
            return {
                 menu: "公司信息",
                 pcode: "",
                 pname: ""
            }

        },
        created() {
            this.pcode = localStorage.pcode
            this.pname = localStorage.pname
            console.log(this.pcode)
        },
        methods: {
            openView(name) {
                this.$router.replace(name)
                console.log(name);
                this.bread = "/" + name;
            },
            login() {
                this.$store.dispatch('logout').then(() => {
                    localStorage.removeItem("islogin");
                    this.$router.replace('/login')

                })
            },
        },
        computed: {
            user() {
                return this.$store.state.user
                console.log(this.$store.state.user)
            },
            ptype() {
                return localStorage.ptype
            },
            preservestaff() {
                return localStorage.preservestaff
            },
            pquestionnaire() {
                return localStorage.pquestionnaire
            }
        },
        mounted() {


            console.log(this.$route.path);


            this.$nextTick(() => {
                this.menu = this.$route.path.slice(1)
                this.$refs.menu.updateActiveName();
            })


        },
}
</script>
<style>
@import '../style/style.css';

/*引入公共样式*/
</style>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
